<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>

<!-- 
The separator is semicolon because numbers in the log file are exported 
according to the german notation and thus have a comma as decimal separator.
--> 
<xsl:variable name="separator">
  <xsl:text>;</xsl:text>
</xsl:variable>

<xsl:template match="log">
  <!-- ============= Begin heading ============= -->
  <xsl:text>PRIM_KEY</xsl:text>
  <xsl:value-of select="$separator"/>  
  <xsl:text>EXP_1</xsl:text>
  <xsl:value-of select="$separator"/>
  <xsl:text>EXP_2</xsl:text>
  <xsl:value-of select="$separator"/>
  <xsl:text>LOG_FILE_N</xsl:text>
  <xsl:value-of select="$separator"/>
  <xsl:text>EXP_COND</xsl:text>
  <xsl:value-of select="$separator"/>
  <xsl:text>DATE_WT</xsl:text>
  <xsl:value-of select="$separator"/>
  <xsl:text>DES_FILE</xsl:text>
  <xsl:value-of select="$separator"/>
  <xsl:text>START_TIME</xsl:text>
  <xsl:value-of select="$separator"/>
  <xsl:text>EVENT_NAME</xsl:text>
  <xsl:value-of select="$separator"/>
  <xsl:text>REL_TIME</xsl:text>
  <xsl:value-of select="$separator"/>
  <xsl:text>TIME_SD</xsl:text>
  <xsl:value-of select="$separator"/>
  <xsl:text>POS_X</xsl:text>
  <xsl:value-of select="$separator"/>
  <xsl:text>POS_Y</xsl:text>
  <xsl:value-of select="$separator"/>
  <xsl:text>NEW_POS_Y</xsl:text>
  <xsl:value-of select="$separator"/>
  <xsl:text>UTM_X</xsl:text>
  <xsl:value-of select="$separator"/>
  <xsl:text>UTM_Y</xsl:text>
  <xsl:value-of select="$separator"/>
  <xsl:text>POS_O_X</xsl:text>
  <xsl:value-of select="$separator"/>
  <xsl:text>POS_O_Y</xsl:text>
  <xsl:value-of select="$separator"/>
  <xsl:text>N_POS_O_Y</xsl:text>
  <xsl:value-of select="$separator"/>
  <xsl:text>UTM_O_X</xsl:text>
  <xsl:value-of select="$separator"/>
  <xsl:text>UTM_O_Y</xsl:text>
  <xsl:value-of select="$separator"/>
  <xsl:text>INT_MAP</xsl:text>
  <xsl:value-of select="$separator"/>
  <xsl:text>INT_DETOUR</xsl:text>
  <xsl:value-of select="$separator"/>
  <xsl:text>INT_STAND</xsl:text>
  <xsl:value-of select="$separator"/>
  <xsl:text>AREA</xsl:text>
  <xsl:value-of select="$separator"/>
  <xsl:text>DETOURS&#10;</xsl:text>
  <!-- ============= Begin event ============= -->
  <xsl:for-each select="event">
    <xsl:value-of select="@Primary_Key"/>
    <xsl:value-of select="$separator"/>  
    <xsl:value-of select="@Experimenter_1"/>
    <xsl:value-of select="$separator"/>  
    <xsl:value-of select="@Experimenter_2"/>
    <xsl:value-of select="$separator"/>  
    <xsl:value-of select="@Log_File_Number"/>
    <xsl:value-of select="$separator"/>  
    <xsl:value-of select="@Exp_Cond"/>
    <xsl:value-of select="$separator"/>  
    <xsl:value-of select="@Date"/>
    <xsl:value-of select="$separator"/>  
    <xsl:value-of select="@Design_File"/>
    <xsl:value-of select="$separator"/>  
    <xsl:value-of select="@Start_Time"/>
    <xsl:value-of select="$separator"/>  
    <xsl:value-of select="@Event_Name"/>
    <xsl:value-of select="$separator"/>  
    <xsl:value-of select="@Relative_Time"/>
    <xsl:value-of select="$separator"/>  
    <xsl:value-of select="@Time_SD"/>
    <xsl:value-of select="$separator"/>  
    <xsl:value-of select="@Pos_x"/>
    <xsl:value-of select="$separator"/>  
    <xsl:value-of select="@Pos_y"/>
    <xsl:value-of select="$separator"/>  
    <xsl:value-of select="@New_Pos_y"/>
    <xsl:value-of select="$separator"/>  
    <xsl:value-of select="@UTM_x"/>
    <xsl:value-of select="$separator"/>  
    <xsl:value-of select="@UTM_y"/>
    <xsl:value-of select="$separator"/>  
    <xsl:value-of select="@Pos_Object_x"/>
    <xsl:value-of select="$separator"/>  
    <xsl:value-of select="@Pos_Object_y"/>
    <xsl:value-of select="$separator"/>  
    <xsl:value-of select="@New_Pos_Object_y"/>
    <xsl:value-of select="$separator"/>  
    <xsl:value-of select="@UTM_Object_x"/>
    <xsl:value-of select="$separator"/>  
    <xsl:value-of select="@UTM_Object_y"/>
    <xsl:value-of select="$separator"/>  
    <xsl:value-of select="@Interval_Pairs_Map"/>
    <xsl:value-of select="$separator"/>  
    <xsl:value-of select="@Interval_Pairs_Detours"/>
    <xsl:value-of select="$separator"/>  
    <xsl:value-of select="@Interval_Pairs_Standing"/>
    <xsl:value-of select="$separator"/>  
    <xsl:value-of select="@Area"/>
    <xsl:value-of select="$separator"/>  
    <xsl:value-of select="@Detours"/>
    <xsl:text>&#10;</xsl:text>
  </xsl:for-each>
  
</xsl:template>

</xsl:stylesheet>
